%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/condition-featured-messages"
    Bucket0("Bucket 0 (root)<br /><br />1: 79, 83<br />ᐳ: 9, 10, 95, 96, 97, 99, 11, 13, 19, 28, 32<br />2: 87, 91<br />3: PgSelect[8]<br />ᐳ: Access[88], Access[92]<br />4: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 96, 88, 92<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 96, 88, 15, 92<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 89, 93, 90, 94<br />2: Connection[27]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 27, 94, 90<br /><br />ROOT Connection{2}ᐸ90ᐳ[27]"):::bucket
    Bucket6("Bucket 6 (listItem)<br />Deps: 50, 80, 84<br /><br />ROOT __Item{6}ᐸ33ᐳ[44]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 45, 80<br /><br />ROOT PgSelectSingle{6}ᐸmessagesᐳ[45]<br />1: <br />ᐳ: 54, 81, 82<br />2: PgSelectRows[63]<br />ᐳ: First[62], PgSelectSingle[64]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 46, 45, 84, 56<br /><br />ROOT Edge{6}[46]"):::bucket
    Bucket9("Bucket 9 (nullableBoundary)<br />Deps: 64<br /><br />ROOT PgSelectSingle{7}ᐸusersᐳ[64]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 45, 84<br /><br />ROOT PgSelectSingle{6}ᐸmessagesᐳ[45]<br />1: <br />ᐳ: 67, 85, 86<br />2: PgSelectRows[75]<br />ᐳ: First[74], PgSelectSingle[76]"):::bucket
    Bucket11("Bucket 11 (nullableBoundary)<br />Deps: 76<br /><br />ROOT PgSelectSingle{10}ᐸusersᐳ[76]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket6
    Bucket6 --> Bucket7 & Bucket8
    Bucket7 --> Bucket9
    Bucket8 --> Bucket10
    Bucket10 --> Bucket11

    %% plan dependencies
    PgSelectInlineApply87["PgSelectInlineApply[87∈0] ➊<br />More deps:<br />- Constantᐸ5ᐳ[96]"]:::plan
    ApplyInput28{{"ApplyInput[28∈0] ➊"}}:::plan
    Lambda32{{"Lambda[32∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[99]"}}:::plan
    PgSelectInlineApply79["PgSelectInlineApply[79∈0] ➊"]:::plan
    PgSelectInlineApply83["PgSelectInlineApply[83∈0] ➊"]:::plan
    ApplyInput28 & Lambda32 & PgSelectInlineApply79 & PgSelectInlineApply83 --> PgSelectInlineApply87
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'INHERIT' ]ᐳ[95]"}}:::plan
    PgSelectInlineApply91["PgSelectInlineApply[91∈0] ➊"]:::plan
    Object11 & Lambda13 & PgSelectInlineApply87 & PgSelectInlineApply91 --> PgSelect8
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    ApplyInput28 & Lambda32 --> PgSelectInlineApply91
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    __InputObject19{{"__InputObject[19∈0] ➊<br />More deps:<br />- Constantᐸtrueᐳ[97]"}}:::plan
    __InputObject19 --> ApplyInput28
    Access88{{"Access[88∈0] ➊<br />ᐸ8.m.subqueryDetailsFor23ᐳ"}}:::plan
    PgSelect8 --> Access88
    Access92{{"Access[92∈0] ➊<br />ᐸ8.m.subqueryDetailsFor39ᐳ"}}:::plan
    PgSelect8 --> Access92
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    Connection27[["Connection[27∈2]<br />ᐸ90ᐳ<br />More deps:<br />- Constantᐸ5ᐳ[96]"]]:::plan
    Lambda90{{"Lambda[90∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda90 --> Connection27
    List89{{"List[89∈2]<br />ᐸ88,15ᐳ"}}:::plan
    Access88 & __Item15 --> List89
    List93{{"List[93∈2]<br />ᐸ92,15ᐳ"}}:::plan
    Access92 & __Item15 --> List93
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    List89 --> Lambda90
    Lambda94{{"Lambda[94∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    List93 --> Lambda94
    PgCursor51{{"PgCursor[51∈3]"}}:::plan
    First49{{"First[49∈3]"}}:::plan
    Access50{{"Access[50∈3]<br />ᐸ90.cursorDetailsᐳ"}}:::plan
    First49 & Access50 --> PgCursor51
    PgCursor53{{"PgCursor[53∈3]"}}:::plan
    Last52{{"Last[52∈3]"}}:::plan
    Last52 & Access50 --> PgCursor53
    ConnectionItems33[["ConnectionItems[33∈3]"]]:::plan
    Connection27 --> ConnectionItems33
    PageInfo38{{"PageInfo[38∈3]"}}:::plan
    Connection27 --> PageInfo38
    First40{{"First[40∈3]"}}:::plan
    PgSelectRows41[["PgSelectRows[41∈3]"]]:::plan
    PgSelectRows41 --> First40
    Lambda94 --> PgSelectRows41
    PgSelectSingle42{{"PgSelectSingle[42∈3]<br />ᐸmessagesᐳ"}}:::plan
    First40 --> PgSelectSingle42
    PgClassExpression43{{"PgClassExpression[43∈3]<br />ᐸcount(*)ᐳ"}}:::plan
    PgSelectSingle42 --> PgClassExpression43
    Access47{{"Access[47∈3]<br />ᐸ27.hasNextPageᐳ"}}:::plan
    PageInfo38 o--o Access47
    Access48{{"Access[48∈3]<br />ᐸ27.hasPreviousPageᐳ"}}:::plan
    Access47 o--o Access48
    ConnectionItems33 --> First49
    Lambda90 --> Access50
    ConnectionItems33 --> Last52
    Access80{{"Access[80∈3]<br />ᐸ90.m.joinDetailsFor58ᐳ"}}:::plan
    Lambda90 --> Access80
    Access84{{"Access[84∈3]<br />ᐸ90.m.joinDetailsFor70ᐳ"}}:::plan
    Lambda90 --> Access84
    Edge46{{"Edge[46∈6]"}}:::plan
    __Item44[/"__Item[44∈6]<br />ᐸ33ᐳ"\]:::itemplan
    PgCursor56{{"PgCursor[56∈6]"}}:::plan
    __Item44 & PgCursor56 --> Edge46
    __Item44 & Access50 --> PgCursor56
    ConnectionItems33 ==> __Item44
    PgSelectSingle45{{"PgSelectSingle[45∈6]<br />ᐸmessagesᐳ"}}:::plan
    __Item44 --> PgSelectSingle45
    List81{{"List[81∈7]<br />ᐸ80,45ᐳ"}}:::plan
    Access80 & PgSelectSingle45 --> List81
    PgClassExpression54{{"PgClassExpression[54∈7]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle45 --> PgClassExpression54
    First62{{"First[62∈7]"}}:::plan
    PgSelectRows63[["PgSelectRows[63∈7]"]]:::plan
    PgSelectRows63 --> First62
    Lambda82{{"Lambda[82∈7]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda82 --> PgSelectRows63
    PgSelectSingle64{{"PgSelectSingle[64∈7]<br />ᐸusersᐳ"}}:::plan
    First62 --> PgSelectSingle64
    List81 --> Lambda82
    PgClassExpression66{{"PgClassExpression[66∈9]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle64 --> PgClassExpression66
    PgClassExpression68{{"PgClassExpression[68∈9]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression66 o--o PgClassExpression68
    List85{{"List[85∈10]<br />ᐸ84,45ᐳ"}}:::plan
    Access84 & PgSelectSingle45 --> List85
    PgClassExpression67{{"PgClassExpression[67∈10]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgClassExpression54 o--o PgClassExpression67
    First74{{"First[74∈10]"}}:::plan
    PgSelectRows75[["PgSelectRows[75∈10]"]]:::plan
    PgSelectRows75 --> First74
    Lambda86{{"Lambda[86∈10]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda86 --> PgSelectRows75
    PgSelectSingle76{{"PgSelectSingle[76∈10]<br />ᐸusersᐳ"}}:::plan
    First74 --> PgSelectSingle76
    List85 --> Lambda86
    PgClassExpression77{{"PgClassExpression[77∈11]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle76 --> PgClassExpression77
    PgClassExpression78{{"PgClassExpression[78∈11]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression77 o--o PgClassExpression78

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,__InputObject19,ApplyInput28,Lambda32,PgSelectInlineApply79,PgSelectInlineApply83,PgSelectInlineApply87,Access88,PgSelectInlineApply91,Access92 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,Connection27,List89,Lambda90,List93,Lambda94 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,ConnectionItems33,PageInfo38,First40,PgSelectRows41,PgSelectSingle42,PgClassExpression43,Access47,Access48,First49,Access50,PgCursor51,Last52,PgCursor53,Access80,Access84 bucket3
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item44,PgSelectSingle45,Edge46,PgCursor56 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression54,First62,PgSelectRows63,PgSelectSingle64,List81,Lambda82 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,PgClassExpression66,PgClassExpression68 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression67,First74,PgSelectRows75,PgSelectSingle76,List85,Lambda86 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,PgClassExpression77,PgClassExpression78 bucket11

